Optimal. Leaf size=116 \[ \frac{\left (8 a^2+4 a b+b^2\right ) \sin (e+f x) \cos (e+f x)}{16 f}+\frac{1}{16} x \left (8 a^2+4 a b+b^2\right )-\frac{b (8 a+3 b) \sin (e+f x) \cos ^3(e+f x)}{24 f}-\frac{b \sin (e+f x) \cos ^5(e+f x) \left ((a+b) \tan ^2(e+f x)+a\right )}{6 f} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.145555, antiderivative size = 116, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 5, integrand size = 23, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.217, Rules used = {3191, 413, 385, 199, 203} \[ \frac{\left (8 a^2+4 a b+b^2\right ) \sin (e+f x) \cos (e+f x)}{16 f}+\frac{1}{16} x \left (8 a^2+4 a b+b^2\right )-\frac{b (8 a+3 b) \sin (e+f x) \cos ^3(e+f x)}{24 f}-\frac{b \sin (e+f x) \cos ^5(e+f x) \left ((a+b) \tan ^2(e+f x)+a\right )}{6 f} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3191
Rule 413
Rule 385
Rule 199
Rule 203
Rubi steps
\begin{align*} \int \cos ^2(e+f x) \left (a+b \sin ^2(e+f x)\right )^2 \, dx &=\frac{\operatorname{Subst}\left (\int \frac{\left (a+(a+b) x^2\right )^2}{\left (1+x^2\right )^4} \, dx,x,\tan (e+f x)\right )}{f}\\ &=-\frac{b \cos ^5(e+f x) \sin (e+f x) \left (a+(a+b) \tan ^2(e+f x)\right )}{6 f}+\frac{\operatorname{Subst}\left (\int \frac{a (6 a+b)+3 (a+b) (2 a+b) x^2}{\left (1+x^2\right )^3} \, dx,x,\tan (e+f x)\right )}{6 f}\\ &=-\frac{b (8 a+3 b) \cos ^3(e+f x) \sin (e+f x)}{24 f}-\frac{b \cos ^5(e+f x) \sin (e+f x) \left (a+(a+b) \tan ^2(e+f x)\right )}{6 f}+\frac{\left (8 a^2+4 a b+b^2\right ) \operatorname{Subst}\left (\int \frac{1}{\left (1+x^2\right )^2} \, dx,x,\tan (e+f x)\right )}{8 f}\\ &=\frac{\left (8 a^2+4 a b+b^2\right ) \cos (e+f x) \sin (e+f x)}{16 f}-\frac{b (8 a+3 b) \cos ^3(e+f x) \sin (e+f x)}{24 f}-\frac{b \cos ^5(e+f x) \sin (e+f x) \left (a+(a+b) \tan ^2(e+f x)\right )}{6 f}+\frac{\left (8 a^2+4 a b+b^2\right ) \operatorname{Subst}\left (\int \frac{1}{1+x^2} \, dx,x,\tan (e+f x)\right )}{16 f}\\ &=\frac{1}{16} \left (8 a^2+4 a b+b^2\right ) x+\frac{\left (8 a^2+4 a b+b^2\right ) \cos (e+f x) \sin (e+f x)}{16 f}-\frac{b (8 a+3 b) \cos ^3(e+f x) \sin (e+f x)}{24 f}-\frac{b \cos ^5(e+f x) \sin (e+f x) \left (a+(a+b) \tan ^2(e+f x)\right )}{6 f}\\ \end{align*}
Mathematica [C] time = 0.269357, size = 79, normalized size = 0.68 \[ \frac{12 (b+(2-2 i) a) (b+(2+2 i) a) (e+f x)-3 b (4 a+b) \sin (4 (e+f x))+3 (4 a-b) (4 a+b) \sin (2 (e+f x))+b^2 \sin (6 (e+f x))}{192 f} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A] time = 0.05, size = 134, normalized size = 1.2 \begin{align*}{\frac{1}{f} \left ({b}^{2} \left ( -{\frac{ \left ( \sin \left ( fx+e \right ) \right ) ^{3} \left ( \cos \left ( fx+e \right ) \right ) ^{3}}{6}}-{\frac{\sin \left ( fx+e \right ) \left ( \cos \left ( fx+e \right ) \right ) ^{3}}{8}}+{\frac{\sin \left ( fx+e \right ) \cos \left ( fx+e \right ) }{16}}+{\frac{fx}{16}}+{\frac{e}{16}} \right ) +2\,ab \left ( -1/4\,\sin \left ( fx+e \right ) \left ( \cos \left ( fx+e \right ) \right ) ^{3}+1/8\,\sin \left ( fx+e \right ) \cos \left ( fx+e \right ) +1/8\,fx+e/8 \right ) +{a}^{2} \left ({\frac{\sin \left ( fx+e \right ) \cos \left ( fx+e \right ) }{2}}+{\frac{fx}{2}}+{\frac{e}{2}} \right ) \right ) } \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A] time = 1.4792, size = 171, normalized size = 1.47 \begin{align*} \frac{3 \,{\left (8 \, a^{2} + 4 \, a b + b^{2}\right )}{\left (f x + e\right )} + \frac{3 \,{\left (8 \, a^{2} + 4 \, a b + b^{2}\right )} \tan \left (f x + e\right )^{5} + 8 \,{\left (6 \, a^{2} - b^{2}\right )} \tan \left (f x + e\right )^{3} + 3 \,{\left (8 \, a^{2} - 4 \, a b - b^{2}\right )} \tan \left (f x + e\right )}{\tan \left (f x + e\right )^{6} + 3 \, \tan \left (f x + e\right )^{4} + 3 \, \tan \left (f x + e\right )^{2} + 1}}{48 \, f} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 1.93942, size = 204, normalized size = 1.76 \begin{align*} \frac{3 \,{\left (8 \, a^{2} + 4 \, a b + b^{2}\right )} f x +{\left (8 \, b^{2} \cos \left (f x + e\right )^{5} - 2 \,{\left (12 \, a b + 7 \, b^{2}\right )} \cos \left (f x + e\right )^{3} + 3 \,{\left (8 \, a^{2} + 4 \, a b + b^{2}\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{48 \, f} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [A] time = 5.98898, size = 314, normalized size = 2.71 \begin{align*} \begin{cases} \frac{a^{2} x \sin ^{2}{\left (e + f x \right )}}{2} + \frac{a^{2} x \cos ^{2}{\left (e + f x \right )}}{2} + \frac{a^{2} \sin{\left (e + f x \right )} \cos{\left (e + f x \right )}}{2 f} + \frac{a b x \sin ^{4}{\left (e + f x \right )}}{4} + \frac{a b x \sin ^{2}{\left (e + f x \right )} \cos ^{2}{\left (e + f x \right )}}{2} + \frac{a b x \cos ^{4}{\left (e + f x \right )}}{4} + \frac{a b \sin ^{3}{\left (e + f x \right )} \cos{\left (e + f x \right )}}{4 f} - \frac{a b \sin{\left (e + f x \right )} \cos ^{3}{\left (e + f x \right )}}{4 f} + \frac{b^{2} x \sin ^{6}{\left (e + f x \right )}}{16} + \frac{3 b^{2} x \sin ^{4}{\left (e + f x \right )} \cos ^{2}{\left (e + f x \right )}}{16} + \frac{3 b^{2} x \sin ^{2}{\left (e + f x \right )} \cos ^{4}{\left (e + f x \right )}}{16} + \frac{b^{2} x \cos ^{6}{\left (e + f x \right )}}{16} + \frac{b^{2} \sin ^{5}{\left (e + f x \right )} \cos{\left (e + f x \right )}}{16 f} - \frac{b^{2} \sin ^{3}{\left (e + f x \right )} \cos ^{3}{\left (e + f x \right )}}{6 f} - \frac{b^{2} \sin{\left (e + f x \right )} \cos ^{5}{\left (e + f x \right )}}{16 f} & \text{for}\: f \neq 0 \\x \left (a + b \sin ^{2}{\left (e \right )}\right )^{2} \cos ^{2}{\left (e \right )} & \text{otherwise} \end{cases} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A] time = 1.15296, size = 113, normalized size = 0.97 \begin{align*} \frac{1}{16} \,{\left (8 \, a^{2} + 4 \, a b + b^{2}\right )} x + \frac{b^{2} \sin \left (6 \, f x + 6 \, e\right )}{192 \, f} - \frac{{\left (4 \, a b + b^{2}\right )} \sin \left (4 \, f x + 4 \, e\right )}{64 \, f} + \frac{{\left (16 \, a^{2} - b^{2}\right )} \sin \left (2 \, f x + 2 \, e\right )}{64 \, f} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]